#ifndef _YOLOV8_H_
#define _YOLOV8_H_

#include "preprocess.h"

#include <memory>

#include <opencv2/opencv.hpp>

#include "utils/common.h"
#include "utils/error.h"

class Yolov8Custom
{
public:
    Yolov8Custom(std::string &&model_path);
    ~Yolov8Custom();

    nn_error_e Inference(void *image_buf, object_detect_result_list *od_results,
                         letterbox_t letter_box);
    nn_error_e Init(rknn_context *ctx_in, bool copy_weight);
    nn_error_e Releaserknn();
    rknn_context *get_rknn_context();
    int get_model_width();
    int get_model_height();

private:
    rknn_app_context_t app_ctx_;
    rknn_context rknn_ctx_{0};
    std::string model_path_;
    std::unique_ptr<rknn_input[]> inputs_;
    std::unique_ptr<rknn_output[]> outputs_;
    std::mutex outputs_lock_;
    ModelType model_type_;
};

#endif // _YOLOV8_H_